It does not work in Java
^([\dx= ×*\/+–—-]*(\(([\dx= ×*\/+–—-]*(?2)*[\dx= ×*\/+–—-]*)+\))*[\dx= ×*\/+–—-]*)+$